#{extends 'include/base.html' /}
#{set title:'修改密码' /}
<div class="work_nav">
    <ul>
        <li><a href="@{Members.home()}">个人主页</a></li>
        <li><a href="@{Members.editor()}">个人资料</a></li>
        <li><a href="@{Members.reciveEmail()}">收件箱</a></li>
        <li><a href="@{Members.sendEmail()}">发件箱</a></li>
        <li class="work_nav_active"><a href="@{Members.changePass()}">修改密码</a></li>
    </ul>
</div>
<div class="simple_wrap">
    <ul class="path_nav">
        <li class="path_index"><a href="@{Application.index(0)}">首页</a></li>
        <li>><a href="@{Members.home()}">个人中心</a></li>
        <li>><a href="@{Members.work()}">我的项目</a></li>
        <li>>修改密码</li>
    </ul>
    <ul class="work_main_nav">
        <li><a href="@{Concerns.myTrend(0)}">动态</a></li>
        <li><a href="@{Members.work(0)}">我的作品</a></li>
        <li><a href="@{Concerns.myConcern(0)}">关注</a></li>
        <li><a href="@{Collections.collectWork(0)}">收藏</a></li>
    </ul>
    <form>
    <div class="clear"></div>
    <p class="set_password_title">修改密码(旧密码不能与新密码重复)</p>
    <div class="my_info_wrap">
        <div class="my_info_info_wrap set_password_wrap ">
            <div class="input_wrap">
                <label>用户名:</label><span>${user.account}</span>
            </div>
            <div class="input_wrap">
                <label>旧密码:</label>
                <input type="password"  name="account.password" id="password" />
            </div>
            <div class="input_wrap">
                <label>新密码:</label>
                <input type="password" name="account.newpassword" id="newpassword" />
            </div>
            <div class="input_wrap">
                <label>重复密码:</label>
                <input type="password" name="account.repassword" id="repassword" />
            </div>
        </div>
        <p class="register_err hidden" style="position:absolute; top: 200px; text-align: center; width: 100%; left: 0px;">错误</p>

    </div>
    <div class="my_info_btn_wrap">
        <button class="my_info_btn_wrap_save" id="btn" type="button">保存</button>
        <button class="my_info_btn_wrap_abort" type="reset">取消</button>
    </div>
    </form>


</div>
<script type="text/javascript">


    $('#btn').click(function () {
        var password = $('#password').val();
        var newpassword = $('#newpassword').val();
        var repassword = $('#repassword').val();
        var  data ={

        };
        data.password=password;
        data.newPassword=newpassword;
        data.rePassword=repassword;
        $.post('@{Api.modifyPassword()}', data, function(res) {
            console.log(res)
            if(res.result==1) {
                location.href="@{Application.index()}"
            }
            else {
                $('.register_err').text(res.data);
                $('.register_err').removeClass('hidden');
            }
        });
    });

</script>